package pokerantani.v2.linematchers;

import java.util.regex.Pattern;

import pokerantani.v2.LineMatcher;
import pokerantani.v2.RE;


public class ActRaise extends LineMatcher {
	static final Pattern pActRaise_PS = Pattern.compile("(" + RE.PLAYER + "): raises \\$?(" + RE.FLOAT + ") to \\$?(" + RE.FLOAT + ")");
	static final Pattern pActRaiseAllIn_PS = Pattern.compile("(" + RE.PLAYER + "): raises \\$?(" + RE.FLOAT + ") to \\$?(" + RE.FLOAT + "),? and is all[\\- ]in");
	static final Pattern pActRaise_FTP = Pattern.compile("(" + RE.PLAYER + ") raises to \\$?(" + RE.FLOAT + ")");
	
	public String playerName;
	public float from;
	public float to;
	public boolean allin;
	
	public boolean match(String line) {
		if(match(line, pActRaise_PS)) {
			playerName = group(1);
			from = groupFloat(2);
			to = groupFloat(3);
			allin = false;
			return true;
		}
		if(match(line, pActRaise_FTP)) {
			playerName = group(1);
			from = 0;
			to = groupFloat(2);
			allin = false;
			return true;
		}
		if(match(line, pActRaiseAllIn_PS)) {
			playerName = group(1);
			from = groupFloat(2);
			to = groupFloat(3);
			allin = true;
			return true;
		}
		return false;
	}
}
